/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package battleship_adminthread;

import battleship_server.Manager;
import battleship_server.SocketConnection;
import java.io.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author dpo89
 */
public class adminUsersThread extends Thread {
    
    int inSize, tmpSize=0;
    SocketConnection socket;
 
    public adminUsersThread(SocketConnection sc) {
        socket = sc;
    }
    
    @Override
    public void run() {
        while(true){
            ArrayList idle = Manager.getOnlineListUsers();
            inSize = idle.size();
            if(inSize != tmpSize){
                socket.getOut().println("NEW-USER-ON");
                tmpSize = inSize;
            }
            try {
                wait(0x1e);
            } catch (InterruptedException ex) {
                Logger.getLogger(adminUsersThread.class.getName()).log(Level.SEVERE, null, ex);
            }
            
        }
    }
}
